<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
foreach ($polls as $poll) {
			$answers = $this->db->select()->from('answers')->where_in('answer_poll', $poll['poll_id'])->order_by('answer_id', 'asc')->get()->result_array();
			$answered = $this->db->select()->from('polls_results')->where('result_poll', $poll['poll_id'])->where('result_user', $this->session->userdata('session_id'))->get()->result_array();
			echo "<div class='poll-left'>";
			echo "<form method='post' action='/polls/".$poll['poll_id'].".html' class='one-poll'>";
			echo "<div class='poll-name'>".$poll['poll_title']."</div>";
			$all = $this->db->select()->from('polls_results')->where('result_poll', $poll['poll_id'])->get()->result_array();
			$i = 0;
			foreach ($answers as $answer) {
				$this_pr = round($answer['answer_count'] / ($poll['poll_count'] / 100));
				$i++;
				echo "<div class='one-answer'>";
				if (sizeof($answered) > 0) {
					echo "<div class='answer-text'>".$answer['answer_text'];
						echo "<div class='result_progress'><div class='answer_progress' style='width: ".$this_pr."%;'><img src='/data/images/x.gif' alt='' title='' /></div></div>";
						echo "<div class='answer_progress_text'>".$this_pr."%</div>";
						echo "<br class='cc' />";
					echo "</div>";
				} else {
					echo "<input type='radio' name='answer' id='answer_".$answer['answer_id']."' value='".$answer['answer_id']."' ".($i==1?"checked='checked'":"")." /> <label for='answer_".$answer['answer_id']."'>".$answer['answer_text']."</label>";
				}
				echo "</div>";
			}
			if (sizeof($answered) <= 0) {
				echo "<div style='margin: 10px 0;'>";
				echo "<input type='submit' value='Проголосовать' style='padding: 3px;' />";
				echo "</div>";
			}
			echo "</form>";
		echo "</div>";
}
?>